{% extends 'admin/base.html' %}

{% block content %}
    <section class="content-header">
        <h1>微电影管理系统</h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 管理员管理</a></li>
            <li class="active">添加管理员</li>
        </ol>
    </section>
    <section class="content" id="showcontent">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">添加管理员</h3>
                    </div>
                    <form role="form" method="post">
                        <div class="box-body">
                            {% for msg in get_flashed_messages(category_filter=['success']) %}
                                <div class="alert alert-success alert-dismissible">
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
                                    </button>
                                    <h4><i class="icon fa fa-ban"></i> 操作成功!</h4>
                                    {{ msg }}
                                </div>
                            {% endfor %}
                            <div class="form-group">
                                <label for="input_name">{{ form.name.label }}</label>
                                {{ form.name }}
                                {% for error in form.name.errors %}
                                    <div class="col-md-12" id="input_user">
                                        <font style="color: red;">{{ error }}</font>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_pwd">{{ form.pwd.label }}</label>
                                {{ form.pwd }}
                                {% for error in form.pwd.errors %}
                                    <div class="col-md-12" id="input_user">
                                        <font style="color: red;">{{ error }}</font>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_re_pwd">{{ form.re_pwd.label }}</label>
                                {{ form.re_pwd }}
                                {% for error in form.re_pwd.errors %}
                                    <div class="col-md-12" id="input_user">
                                        <font style="color: red;">{{ error }}</font>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="form-group">
                                <label for="input_role_id">{{ form.role_id.label }}</label>
                                {{ form.role_id }}
                                {% for error in form.role_id.errors %}
                                    <div class="col-md-12" id="input_user">
                                        <font style="color: red;">{{ error }}</font>
                                    </div>
                                {% endfor %}
                            </div>
                        </div>
                        <div class="box-footer">
                            {{ form.csrf_token }}
                            {{ form.submit }}
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
{% endblock %}

{% block js %}
    <script>
        $(function () {
            $('#g-11').addClass('active');
            $('#g-11-1').addClass('active');
        })
    </script>
{% endblock %}